<template>
  <div>
    <mine-view>
      <van-cell-group inset>
        <van-cell title="权益列表" is-link to="/rights/stock"/>
        <van-cell title="订单记录" is-link to="/order/stock"/>
        <van-cell title="模型管理" is-link to="/module/stock"/>
        <van-cell title="策略管理" is-link to="/strategy/stock"/>
        <van-cell title="决策追踪" is-link to="/holden/stock"/>
        <van-cell title="量化配置" is-link to="/hosted/stock"/>
      </van-cell-group>
    </mine-view>
    <nav-bar path="/mine" @change="path => $router.push(`${path}/stock`)"/>
  </div>
</template>

<script>
import {Dialog} from 'vant'
import {toDateString} from '@/utils'

export default {
  components: {
    MarketLoad: () => import('@/components/MarketLoad.vue'),
    OrderForm: () => import('@/components/OrderForm.vue'),
    MineView: () => import('@/components/MineView.vue'),
    NavBar: () => import('@/components/NavBar.vue'),
  },
  methods: {
    toDateString,
    load() {
      this.$requests.post('/china_stock/rights/obtain').then(resp => {
        if (!resp.length) {
          Dialog.confirm({
            title: '提示',
            message: '当前无可用权益，是否开通？',
          }).then(() => {
            this.$router.push('/order/stock')
          })
        }
      })
    },
  },
  mounted() {
    this.load()
  }
}
</script>

<style scoped>

</style>
